<!--
 * @Description: 
 * @Autor: 商晓彬
 * @Date: 2021-06-23 12:09:31
 * @LastEditors: 商晓彬
 * @LastEditTime: 2021-12-29 14:22:57
-->
<div bsModal #createOrEditModal="bs-modal" (onShown)="onShown()" class="add modal fade" tabindex="-1" role="dialog"
    aria-labelledby="createOrEditModal" aria-hidden="true" [config]="{backdrop: 'static', keyboard: !saving}">
    <div style="width:1440px!important;margin: 1.75rem auto;">
        <div class="modal-content">
            <form *ngIf="active" #bopForm="ngForm" novalidate (ngSubmit)="save()" autocomplete="off">
                <div class="modal-header">
                    <h4 class="modal-title">
                        <span *ngIf="flag">审批</span>
                        <span *ngIf="!flag">审批查看</span>
                    </h4>
                    <button type="button" class="close" (click)="close()" [attr.aria-label]="l('Close')"
                        [disabled]="saving">
                        <span aria-hidden="true">&times;</span>
                    </button>
                </div>
                <div class="modal-body" style="height: 630px!important;overflow: auto;">
                    <div class="row align-items-center" style="margin-top: 25px;">
                        <div class="primeng-datatable-container">
                            <p-treeTable scrollHeight="600px" [lazy]="true" [value]="treeData" [scrollable]="true" [loading]="loadingTable">
                                <ng-template pTemplate="header">
                                    <tr>
                                        <th style="width: 200px">Bom层级</th>
                                        <th style="width: 150px">图号</th>
                                        <th style="width: 150px">名称</th>
                                        <th style="width: 150px">规格型号</th>
                                        <th style="width: 150px">单位</th>
                                        <th style="width: 150px">Bom用量</th>
                                        <th style="width: 150px">年代号</th>
                                        <th style="width: 150px">备注</th>
                                        <th style="width: 150px">Bom版本</th>
                                        <th style="width: 150px">属性</th>
                                        <th style="width: 150px">类别</th>
                                        <th style="width: 150px">细分类别</th>
                                        <th style="width: 150px">状态</th>
                                        <th style="width: 150px">创建人</th>
                                    </tr>
                                </ng-template>
                                <ng-template pTemplate="body" let-rowNode="$implicit" let-rowData="rowData">
                                    <tr [ttSelectableRow]="rowNode" [ttRow]="rowNode"
                                        ttEditableColumn>
                                        <td style="width: 200px">
                                            <p-treeTableToggler [rowNode]="rowNode"></p-treeTableToggler>
                                            {{rowData.levelNum}}
                                        </td>
                                        <td style="width: 150px">{{rowData.materialNo}}</td>
                                        <td style="width: 150px">{{rowData.materialName}}</td>
                                        <td style="width: 150px">{{rowData.model}}</td>
                                        <td style="width: 150px">{{rowData.unitName}}</td>
                                        <td style="width: 150px">
                                            <span>{{rowData.unit1BomDosage}}</span>
                                        </td>
                                        <td style="width: 150px">
                                            <span>{{rowData.yearsNo}}</span>
                                        </td>
                                        <td style="width: 150px">
                                            <span>{{rowData.remark}}</span>
                                        </td>
                                        <td style="width: 150px">{{rowData.versionNo}}</td>
                                        <td style="width: 150px">{{rowData.materialPropertyName}}</td>
                                        <td style="width: 150px">{{rowData.materialTypeName}}</td>
                                        <td style="width: 150px">{{rowData.materialSegmentationName}}</td>
                                        <td style="width: 150px">{{selectStatus(rowData.status)}}</td>
                                        <td style="width: 150px">{{rowData.createUserName}}</td>
                                    </tr>
                                </ng-template>
                            </p-treeTable>
                        </div>
                    </div>
                </div>
                <div class="modal-footer" *ngIf="flag">
                    <div class="p-formgroup-inline">
                        <div >
                            <label style="margin-top: 5px;">审批意见：</label>
                            <textarea name="approvalRemark" rows="2" cols="100" pInputTextarea
                            [(ngModel)]="approvalForm.remark"></textarea>
                        </div>
                    </div>
                    <div class="p-formgroup-inline" style="width: 100%;
                    display: flex;
                    justify-content: center;
                    margin-top: 10px">
                        <button pButton class="ui-button-danger" type="button" label="拒绝" (click)="confues()"
                        style="margin-left: 0.5rem"></button>
                    <button pButton type="button" label="同意"
                        (click)="accept()" style="margin-left: 0.5rem"></button>
                    </div>
                </div>
                <div class="modal-footer" style="flex-flow: row wrap;
                justify-content: center;
                align-items: center;" *ngIf="!flag && approvalList.length != 0">
                    <div class="p-formgroup-inline " [ngClass]="getClass(item)" *ngFor="let item of approvalList">
                        <div *ngIf="item.result == 1"><i class="pi pi-check-circle" style="font-size: 3em"></i></div>
                        <div *ngIf="item.result == 2"><i class="pi pi-times" style="font-size: 3em"></i></div>
                        <div>{{item.getAffairRoles}}</div>
                        <div>{{item.userName}}，{{item.auditTime | momentFormat:'YYYY-MM-DD HH:mm:ss'}}</div>
                        <div>审批意见：{{item.remark}}</div>
                    </div>  
                </div>
            </form>
        </div>
    </div>
</div>